import request from "@/util/http";


export const getWarehouses = () => {
  return request({
    url: '/api/warehouses',
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
};


export const getWarehouseById = (id) => {
  return request({
    url: `/api/warehouses/${id}`,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
};


export const addWarehouse = (data) => {
  return request({
    url: `/api/warehouses`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
};

export const updateWarehouse = (data) => {
  return request({
    url: `/api/warehouses`,
    method: 'put',
    data,
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
};

export const deleteWarehouse = (data) => {
  return request({
    url: `/api/warehouses`,
    method: 'delete',
    data,
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
};